﻿<?php 
error_reporting(0);

include 'conn.php';
include 'common.php';?>
<!DOCTYPE html>
<html lang="en">
<head>

<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>考试删除</title>
<body>
<div class="container">
<div class="nav_header">
<?php include 'head.php';?>
</div>
<div class="main_cj_content">
<?php

echo "<p class='welcome'>删除结果:</p><hr><br />";
if($_POST['examid'])
{
	
	$examid=getpost('examid');
	//echo $examid;
	$exe1="delete from grades where exam_id=" . $examid;
	$exe2="delete from exams where id=".$examid;
	mysql_query("BEGIN");
	$rs1=mysql_query($exe1);
	$rs2=mysql_query($exe2);
	if($rs1&&$rs2)
	{
		mysql_query("COMMIT");
		echo "<script language=javascript>alert('删除成功!');window.location='search_exam.php'</script>";
	}
	else {
mysql_query("ROLLBACK");
echo "<script language=javascript>alert('删除失败!请联系数据库管理员!');window.location='search_exam.php'</script>";
}
}
?>
</div>
</div>
</body>
</html>
